//
//  YHViewTestVC.m
//  LyhToolsTest
//
//  Created by LYH on 2018/12/28.
//  Copyright © 2018年 LYH.com. All rights reserved.
//

#import "YHViewTestVC.h"

@interface YHViewTestVC ()
@property (nonatomic, strong) UIImageView *imagV;
@property (nonatomic, strong) UIButton *ClipBtn;//裁剪btn
@end

@implementation YHViewTestVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self Creatnava];
}
- (void)Creatnava
{
    WeakSelf;
    wself.ts_navgationBar = [TSNavigationBar navWithTitle:@"view分类测试" backAction:^{
        [self.navigationController popViewControllerAnimated:YES];
    }];
}
//设置试图s约束
- (void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    //加载图片
    [self.imagV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.ts_navgationBar.mas_bottom).offset(10);
        make.left.equalTo(self.view.mas_left).offset(10);
        make.size.mas_equalTo(CGSizeMake(80, 80 ));
    }];
    //加载按钮
    [self.ClipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.ts_navgationBar.mas_bottom).offset(10);
        make.left.equalTo(self.imagV.mas_right).offset(10);
        make.size.mas_equalTo(CGSizeMake(50, 35 ));
    }];
}
#pragma -mark ————————————————————Action————————————————————
//裁剪
- (void)ClipClick
{
    _imagV.image = [UIImage ellipseImage:[UIImage imageNamed:@"image1"] withInset:0];
}



- (UIImageView *)imagV
{
    if (!_imagV) {
        _imagV = [[UIImageView alloc]init];
        _imagV.image = [UIImage imageNamed:@"image1"];
          [self.view addSubview:self.imagV];
    }
    return _imagV;
}
- (UIButton *)ClipBtn
{
    if (!_ClipBtn) {
        _ClipBtn = [[UIButton alloc]init];
        _ClipBtn.title = @"裁剪";
        _ClipBtn.titleColor = [UIColor blackColor];
        [_ClipBtn addTarget:self action:@selector(ClipClick)];
        [self.view addSubview:_ClipBtn];
    }
    return _ClipBtn;
}
@end
